#!/bin/bash
set -e

source_root_url="https://gitee.com/zhoujiayaoo/easy-install/raw/master"

echo "删除 /etc/yum.repos.d.bak 文件夹"
rm -rf /etc/yum.repos.d.bak

echo "备份旧的 /etc/yum.repos.d/"
cp -a /etc/yum.repos.d/ /etc/yum.repos.d.bak

echo "下载新的 yum 源配置到 /etc/yum.repos.d/"
curl -fsSL "$source_root_url/resources/CentOS-Base.repo"   -o /etc/yum.repos.d/CentOS-Base.repo
curl -fsSL "$source_root_url/resources/docker-ce.repo"      -o /etc/yum.repos.d/docker-ce.repo
curl -fsSL "$source_root_url/resources/epel.repo"           -o /etc/yum.repos.d/epel.repo

echo "清理 yum 缓存"
yum clean all
